#include <stdio.h>

// Define a class-like structure using macros
#define CLASS(Name) \
    struct Name {    \
        int data;    \
        void (*print)(struct Name*); \
    }; \

// Define constructor for the "class"
#define CONSTRUCTOR(Name, value) \
    struct Name* Name##_create() { \
        struct Name* obj = (struct Name*)malloc(sizeof(struct Name)); \
        obj->data = value; \
        obj->print = Name##_print; \
        return obj; \
    } \

// Define a method for the "class"
#define METHOD(Name, method_body) \
    void Name##_print(struct Name* self) { \
        method_body \
    } \

int main() {
    CLASS(MyClass);  // Define the class
    CONSTRUCTOR(MyClass, 42);  // Define the constructor

    // Define the method for MyClass
    METHOD(MyClass, {
        printf("Data: %d\n", self->data);
    });

    // Create an instance of MyClass
    struct MyClass* obj = MyClass_create();

    // Call the method
    obj->print(obj);

    // Clean up
    free(obj);

    return 0;
}